package top.yangyitao.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import top.yangyitao.entity.PaySlip;

@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class PaySlipDto {
	long id;
	String printDay;
	String startDay;//开始日期
	String endDay;//结束日期
	int workDays;//出勤天数
	int lateOrLeaveTimes;//迟到早退次数
	int absentTimes;//矿工次数
	String realCash;//实发工资
	String cash;//工资
	String bonusCash;//奖金
	UserDto user;
	public PaySlipDto convert(PaySlip paySlip) {
		setId(paySlip.getId());
		setPrintDay(paySlip.getPrintDay());
		setStartDay(paySlip.getStartDay());
		setEndDay(paySlip.getEndDay());
		setWorkDays(paySlip.getWorkDays());
		setLateOrLeaveTimes(paySlip.getLateOrLeaveTimes());
		setAbsentTimes(paySlip.getAbsentTimes());
		setRealCash(paySlip.getRealCash());
		setCash(paySlip.getCash());
		setBonusCash(paySlip.getBonusCash());
		setUser(new UserDto().convert(paySlip.getUser()));
		return this;
	}
}
